package main

import (
	"fmt"
	"net/http"
	"time"
)

func main() {
	http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
		h1 := []byte("<h1 id='msg'><h1>")
		updataScript := `<script>document.getElementById("msg").innerHTML='%d';</script>`
		//writer.Header().Set("Transfer-Encoding", "chunked")
		writer.Write(h1)
		for i := 1; i <= 5; i++ {
			writer.Write([]byte(fmt.Sprintf(updataScript, i)))
			writer.(http.Flusher).Flush()
			time.Sleep(time.Second * 1)
		}
	})
	http.ListenAndServe(":8080", nil)
}
 /